package com.ebraga.trackerclub.android.view.fragment;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;

import com.ebraga.trackerclub.android.R;
import com.ebraga.trackerclub.android.view.MyWebViewClient;

/**
 * Fragment that appears in the "content_frame", shows a planet
 */
public class MainFragment extends Fragment {
    public static final String ARG_MENU_ITENS = "menu_itens";

    public MainFragment() {
        // Empty constructor required for fragment subclasses
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
    	
    	View mainView = (View) inflater.inflate(R.layout.fragment_main, container, false);
        WebView webView = (WebView) mainView.findViewById(R.id.webview);
        webView.setWebViewClient(new MyWebViewClient());
        webView.getSettings().setBuiltInZoomControls(false);
        webView.getSettings().setSupportZoom(false);
        webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        webView.getSettings().setAllowFileAccess(true);
        webView.getSettings().setDomStorageEnabled(true);
        webView.getSettings().setJavaScriptEnabled(true);
        
        int i = getArguments().getInt(ARG_MENU_ITENS);
        
        if (i == 0) {
        	webView.loadUrl("file:///android_asset/construcao.html");
        } else if (i == 1) {
        	webView.loadUrl("file:///android_asset/construcao.html");
        } else if (i == 2) {
        	webView.loadUrl("file:///android_asset/construcao.html");
        } else {
        	webView.loadUrl("file:///android_asset/construcao.html");
        }
        
        return mainView;
    }
}